public class Solution {
    public class TreeNode {
    int val = 0;
    TreeNode left = null;
    TreeNode right = null;
    public TreeNode(int val) {
      this.val = val;
    }
  }
    public int maxDepth (TreeNode root) {
        if(root == null){
            return 0;
        }
        int leftHeight = maxDepth(root.left);

        int rightHeight = maxDepth(root.right);

        return leftHeight>rightHeight? leftHeight+1:rightHeight+1;
    }


}
